<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style type="text/css">
/*CSS de tablas y demases */
body{
	padding: 0.3in 0.5in 0.5in 0.5in;
	font-family:"Sans-serif",Arial, Verdana;
}
table{
        width: 100%;
        font: normal 14px  Arial;
        /*table-layout:fixed;*/
        border:1px;
}
table td {
        color: #000000;
        /*overflow:hidden;*/
        text-transform: uppercase;
        /*padding: 1px 1px 1px 3px;*/
        text-align:left;
        /*table-layout:fixed;*/
        border:0px;
        height:23px;
        vertical-align:bottom;
}

.rol font{
	font-size:220%;
 	font-weight:bold;
}
.rol{
	vertical-align:middle;
	font-size:18px;
}
#materia
{
	width:200px;
	table-layout:fixed;
}
h1{
	font-size:260%;
	font-weight:lighter
}
</style>
</head>
<body>
<script type="text/php">
$header=$pdf->open_object();
$font = Font_Metrics::get_font("Sans-serif", "normal");
$texto = "www.termaule.cl";
$hpagina = $pdf->get_height();
$wpagina = $pdf->get_width();
$wtexto = Font_Metrics::get_text_width($texto, $font, 12);
$pdf->page_text($wpagina/2 - $wtexto/2, $hpagina-100, $texto,
$font, 14, array(0,0,0));
$pdf->close_object();
$pdf->add_object($header, "all");
</script>
<?php $nchar= 55; // aqui se puede cambiar el ancho de la columna en numero de caracteres?>
<div align='center'><h2>REPÚBLICA DE CHILE</h2><br /><h1>TRIBUNAL ELECTORAL REGIONAL<br />SÉPTIMA REGIÓN<br />TALCA</h1></div>
<br/><br/><br/>



<?php 
foreach ($results ->result() as $row){ 
	$search = array("<br />","\n");
	$materia = str_replace ($search  ,'', $row->materia );
?>


<table id="caratula">
	<tr>
		<th width ='50%'><div align='left' class="rol"><font>ROL N&deg; </font><?php echo "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;".$row->rol; ?>.-</div><br/></th>
		<th width ='50%'></th>
	</tr>
  	<tr>
  		<td><div align='center'><p>PRESIDENTE</p><p>DON:&nbsp;<?php echo $row->presidente; ?></p></div></td>
  		<td><div align='center'><p>SECRETARIO-RELATOR</p><p>DON:&nbsp;<?php echo $row->relator; ?></p></div></td>
  	</tr>
</table>


<table id="caratula">
  <tr><td width="19%">RECLAMANTE</td><td width="1%">:</td><td width="80%" style="border-bottom:1px dotted"><?php echo wordwrap($row->reclamante,  $nchar, "<br />\n"); ?></td></tr>
  <tr><td>DOMICILIO</td><td>:</td><td style="border-bottom:1px dotted"><?php echo wordwrap($row->domicilio_reclamante,  $nchar, "<br />\n"); ?></td></tr>
  <tr><td>PATROCINANTE</td><td>:</td><td style="border-bottom:1px dotted"><?php echo wordwrap($row->patrocinante,  $nchar, "<br />\n"); ?></td></tr>
  <tr><td>DOMICILIO</td><td>:</td><td style="border-bottom:1px dotted"><?php echo wordwrap($row->domicilio_patrocinante,  $nchar, "<br />\n"); ?></td></tr>
  <tr><td>APODERADO</td><td>:</td><td style="border-bottom:1px dotted"><?php echo wordwrap($row->apoderado,  $nchar, "<br />\n"); ?></td></tr>
  <tr><td>DOMICILIO</td><td>:</td><td style="border-bottom:1px dotted"><?php echo wordwrap($row->domicilio_apoderado,  $nchar, "<br />\n"); ?></td></tr>
    <tr><td></td><td></td></tr>
  <tr><td>RECLAMADO</td><td>:</td><td style="border-bottom:1px dotted"><?php echo wordwrap($row->reclamado,  $nchar, "<br />\n"); ?></td></tr>
  <tr><td>DOMICILIO</td><td>:</td><td style="border-bottom:1px dotted"><?php echo wordwrap($row->domicilio_reclamado,  $nchar, "<br />\n"); ?></td></tr>
  <tr><td>PATROCINANTE</td><td>:</td><td style="border-bottom:1px dotted"><?php echo wordwrap($row->patrocinante_r,  $nchar, "<br />\n"); ?></td></tr>
  <tr><td>DOMICILIO</td><td>:</td><td style="border-bottom:1px dotted"><?php echo wordwrap($row->domicilio_patrocinante_r,  $nchar, "<br />\n"); ?></td></tr>
  <tr><td>APODERADO</td><td>:</td><td style="border-bottom:1px dotted"><?php echo wordwrap($row->apoderado_r,  $nchar, "<br />\n"); ?></td></tr>
  <tr><td>DOMICILIO</td><td>:</td><td style="border-bottom:1px dotted"><?php echo wordwrap($row->domicilio_apoderado_r,  $nchar, "<br />\n"); ?></td></tr>
  <tr><td></td><td></td></tr>
  <tr><td style="vertical-align:top;">MATERIA</td><td style="vertical-align:top;">:</td><td style="text-transform:uppercase"><?php echo wordwrap($materia,  $nchar, "<br />\n"); ?></td></tr>
  <tr><td></td><td></td></tr>
  <tr><td>INICIACI&Oacute;N</td><td>:</td><td style="border-bottom:1px dotted"><?php echo $this->my_library->dayMonthYear($row->fecha_iniciacion); ?></td></tr>
<?php }?>
</table>
</body>
</html>